#ifndef FORMATSTRING_H_INCLUDED
#define FORMATSTRING_H_INCLUDED
// *** ADDED BY HEADER FIXUP ***
#include <wx/string.h>
// *** END ***


#include <cstring>
#include <string>

namespace FormatString
{
    wxChar list[][3] = {wxT("。."),wxT("，,"),wxT("？?"),wxT("！!"),wxT("；;")
        ,wxT("‘\'"),wxT("“\""),wxT("”\"")};
    const int n = sizeof(list)/sizeof(list[0]);
    wxChar Convert(const wxChar& st)
	{
		for(int i=0;i<n;++i) if(st==list[i][0])
			return list[i][1];
		return st;
	}
	inline bool IsLetter(const wxChar& c)
	{
	    return (c>='a'&&c<='z')||(c>='A'&&c<='Z');
	}
	inline bool IsNumber(const wxChar& c)
	{
	    return c>='0'&&c<='9';
	}
	wxString Split(wxString& str)
	{
	    str = str.Trim(false);
		wxString ans;
		bool word = true;
		for(size_t i=0;i<str.size();++i)
		{
			if(IsLetter(str[i])||IsNumber(str[i]))
            {
                if(!word) ans += ' ', word = true;
                ans += str[i];
            }
			else
			{
			    ans += ' ';
			    ans += Convert(str[i]);
			    word = false;
			}
		}
		return ans.Trim();
	}
	void DelPunc(wxString& str)
	{
	    for(size_t i=0;i<str.size();++i)
        {
            //for(int j=0;j<n;++j) if(str[i]==list[j][1]) str[i] = ' ';
        }
        //str.Trim();
	}
};

#endif // FORMATSTRING_H_INCLUDED
